import { $get, $post, $postObj, $delete } from "./httpAxios";
import { getCookie } from "@/assets/js/cookie";

const mock = false;

const Login = {
    login(params) {
        return $postObj(`/batoauth2/oauth/token`, params);
    },
    userId(params){
        return $postObj(`/batoauth2/login/user/search`,params);
    },
    logOut(params){
        return $postObj(`batoauth2/logout/logout`, params);

    },
}
const Role = {
    getNowAuthCorrect(params) {
        return $get(`/batoauth2/roleManage/role/auth/list/${params.roleId}`);
    },
    getRoleList(params) {
        return $postObj("/batoauth2/roleManage/role/list", params);
    },
    editUser(params) {
        return $postObj("/batoauth2/roleManage/role/save", params);
    },
}

const User = {
    getUserList({ userName, pageNumber, clientId,pageSize }) {
        return $postObj(`/batoauth2/login/user/list`, { userName, pageNumber,clientId, pageSize });
    },
    getRoleList(params) {
        return $postObj("/batoauth2/roleManage/role/list", params);
    },
}

const Basic = {
    getProvince() {
        return $get(`/batfront/region/list?mock=${mock}`);
    },
    getCity({ parentId }) {
        return $get(`/batfront/region/${parentId}?mock=${mock}`)
    },
    getCode({ type }) {
        return $get(`/batoauth2/code/${type}?mock=${mock}`)
    },
    getProvinceAndCity(params) {
        return $get(`/batfront/region/regionName?mock=${mock}`, params);
    }
}

const FileManagement = {
    getThirdPartySearch() {
        return $get(`/batoauth2/thirdparty/search`);
    }
}

export {
    Login,
    Role,
    User,
    Basic,
    FileManagement,
}